//
//  MeatPriceViewController.m
//  PigMarket
//
//  Created by 张敬 on 2019/7/30.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "MeatPriceViewController.h"
#import "MeatPriceTableViewCell.h"


@interface MeatPriceViewController ()

@end

@implementation MeatPriceViewController

#pragma mark - lifecycle methods

- (void)setupUI{
    
//    self.currentIndex = 0;
//    [self.view addSubview:self.footer];
//
//    CGFloat h = KScreenHeight - (TJ_MeatShop_Header + _footer.height + 42);
//    self.tableView.height = h;
//    self.footer.mj_y = self.tableView.bottom;
}

#pragma mark - networking methods
#pragma mark - response methods
#pragma mark - public methods

#pragma mark - tableview delegate/dataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return indexPath.row == 0 ?44 :54;
}


//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return 10;
//}
//
//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//    UIView *sectionView = [[UIView alloc] init];
//    sectionView.backgroundColor = mBackgroudColor;
//    return sectionView;
//}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    MeatPriceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MeatPriceTableViewCell"];
    
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
    }

    if (indexPath.row == 0) {
        cell.type = MeatPriceTableViewCellType_Blod;
        cell.typeNameLab.text = @"部位";
        cell.blackPriceLab.text = @"黑猪参考单价";
        cell.whitePriceLab.text = @"白猪参考单价";
        return cell;
    }
    
    cell.type = MeatPriceTableViewCellType_Default;
    cell.typeNameLab.text = @"前排肉";
    cell.blackPriceLab.text = @"¥ 1436.78";
    cell.whitePriceLab.text = @"¥ 1436.78";

    
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}

#pragma mark - setter and getter


#pragma mark - override methods

- (void)registerTableViewCell{
    
    [self.tableView registerClass:[MeatPriceTableViewCell class] forCellReuseIdentifier:@"MeatPriceTableViewCell"];
    
    self.tableView.height = KScreenHeight - (TJ_NavBarHeight);
    self.tableView.separatorColor = mIconLineColor;
    
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 10)];
    view.backgroundColor = mBackgroudColor;
    self.tableView.tableFooterView = view;
}




@end
